{% extends "common/internal_page.html" %}

{% block content %}

<style type="text/css">
.is_inactive {text-decoration: line-through;}
</style>

{% block extrahead %}
<script type="text/javascript" 
    src="/media/common/js/jquery/jquery-1.3.1.js"></script>
<script type="text/javascript" 
    src="/media/auth/js/auth.js"></script>
{% endblock %}

{% if msg %}
<p>
{{ msg }}
</p>
{% endif %}

<p>
There are {{ num_active_users }} active users in the system.
<a href="/auth/add_user/">Click here to add a new user</a>.
</p>

To modify an existing user's information, click on their name below.

<p>
Select: <a id="checkbox_all" href="">All</a>,
        <a id="checkbox_none" href="">None</a>,
        <a id="checkbox_empty_pwd" href="">No Password</a>
</p>

<form method="post" id="user-management-form" action="/auth">
<input type="submit" class="button" name="SendPwdEmails" value="Send Password Change Email(s)"/>
<table border=1 cellpadding=4>
	<tr>
		<th/>
		<th>name</th>
        <th>dj name</th>
		<th>email</th>
		<th>roles</th>
		<th>last login</th>
	</tr>
{% for u in all_users %}
	<tr {% if u.is_active %}{% else %}class="is_inactive"{% endif %}>
		<td><input type="checkbox"
{% if u.password %}
                   class="checkbox"
{% else %}
                   class="checkbox empty_pwd"
{% endif %}
                   name="checkbox_{{ forloop.counter }}"/></td>
		<td><a href="/auth/edit_user?email={{ u.email }}">
{{ u.last_name }}, {{ u.first_name }}</a></td>
        <td>{{ u.dj_name }}</td>
		<td>{{ u.email }}</td>
		<td>
			<small>
{% if u.is_superuser %}<b>superuser</b><br>{% endif %}
{% for r in u.roles %}{% if forloop.counter0 %}<br>{% endif %}
{{ r }}
{% endfor %}
			</small>
		</td>
		<td>{{ u.last_login|date:"F j, Y P" }}</td>
{% endfor %}
	</tr>
</table>
</form>
{% endblock %}
